package com.charactereducation.serviceproviderusercenter.service;

import com.charactereducation.dao.UserMapper;
import com.charactereducation.module.vo.User;
import com.charactereducation.tools.myRunTime.MyRunTimeExcption;
import com.charactereducation.webcore.service.ServiceBase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Baggio on 2019-2-14.
 */
@Service
public class UserServiceImpl extends ServiceBase implements UserService {

    @Autowired
    UserMapper userMapper;


    @Override
    public User getUserById(Long userId) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public User Login(String phone, String passWord) throws MyRunTimeExcption {
        Map map = new HashMap<String,String>();
        map.put("phone",phone);
        map.put("passWord",passWord);
        User user = userMapper.Login(map);
        return user;
    }

    @Override
    public List<User> getUserList(Map<String, String> map) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public void modifyUser(User user) throws MyRunTimeExcption {
        if(user.getTid()==null){
            this.insertUser(user);
        }
    }
    public void insertUser(User user) throws MyRunTimeExcption {
        userMapper.insertUser(user);
    }
}
